package com.HQCourse.vod.vod.controller;


import com.HQCourse.result.Result;
import com.HQCourse.vod.vod.service.SubjectService;
import com.example.HQCourse.model.vod.Subject;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 * @author zww
 * @since 2023-06-24
 */
@Api("subject查询接口")
@RequestMapping("admin/vod/teacher/subject")
@RestController
//@CrossOrigin
public class SubjectController {
    @Autowired
    private SubjectService subjectService;
    @ApiOperation("根据id查询")
    @GetMapping("/listTeacher/{id}")
    public Result selectSubjectList(@PathVariable("id")Long id){
        List<Subject> subjects = subjectService.selectListById(id);
    return Result.ok(subjects);
    }
    @ApiOperation("课程分类导出")
    @GetMapping("exportData")
    public void exportExcel(HttpServletResponse response){
        subjectService.exportData(response);

    }
    @ApiOperation("课程分类导入")
    @PostMapping ("inputData")
    public Result inPortExcel(MultipartFile file){
        subjectService.inport(file);
       return Result.ok(null);
    }


}

